package jgl.vajra.management.part.mine.viewModel;

import java.util.List;
import java.util.Map;

import jgl.vajra.management.bean.NicknamePageBean;
import jgl.vajra.management.part.mine.contract.NicknamePageContract;
import jgl.vajra.management.part.mine.model.NicknamePageModel;
import jgl.vajra.management.widget.mvvm.factory.CreateModel;
import jgl.vajra.management.widget.retrofithelper.rxsubscriber.ProgressObserver;

@CreateModel(NicknamePageModel.class)
public class NicknamePageViewModel extends NicknamePageContract.ViewModel{
    @Override
    public void getNicknameData(Map<String, Object> map) {
        mModel.getNicknameData(map).subscribe(new ProgressObserver<List<NicknamePageBean>>(true,this) {
            @Override
            public void _onNext(List<NicknamePageBean> data) {
                mView.returnNicknamePageData(data);
            }

            @Override
            public void _onError(String errorMessage, int errorCode) {
                super._onError(errorMessage, errorCode);
            }
        });
    }

    @Override
    public void modifyInformation(Map<String, Object> map) {
        mModel.modifyInformation(map).subscribe(new ProgressObserver<Object>(true,this) {
            @Override
            public void _onNext(Object o) {
                mView.returnModifyInformationData();
            }

            @Override
            public void _onError(String errorMessage, int errorCode) {
                super._onError(errorMessage, errorCode);
            }
        });
    }
}
